using System;
using System.Reflection;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Robotics4.NET;

namespace RobletCInterfaceGenerator
{
    class Program
    {
        static Dictionary<string, Type> FindRoblets(Assembly a)
        {
            Dictionary<string, Type> ret = new Dictionary<string, Type>();
            foreach (Type t in a.GetTypes())
                if (t.IsSubclassOf(typeof(RobletBase)))
                    ret.Add(t.Name, t);

            return ret;
        }

        static void GenerateRobletInterface(Type t, int id)
        {
            GenerateRobletInterface(t, null, id);
        }

        static void GenerateRobletInterface(Type t, string name, int id)
        {
            RobletBase rob = name == null ? (RobletBase)Activator.CreateInstance(t) : (RobletBase)Activator.CreateInstance(t, name);
            RobletInterface interf;
            Type[] ctxt;
            rob.GetRobletInterface(out interf, out ctxt);
            OutputMessageAttribute[] outm = (OutputMessageAttribute[])t.GetCustomAttributes(typeof(OutputMessageAttribute), true);
            InputMessageAttribute[] inm = (InputMessageAttribute[])t.GetCustomAttributes(typeof(InputMessageAttribute), true);

        }

        static void Main(string[] args)
        {
            Assembly assembly = Assembly.LoadFile(args[0]);
            Dictionary<string, Type> robs = FindRoblets(assembly);
        }
    }
}
